#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

int main(){
    char* buf = (char*)malloc(8 * sizeof(char));
    printf("%p\n", buf);
    FILE * fp = fopen("getline.c", "r");
    size_t len = 8;
    //返回值不包含终止符\0
    ssize_t n = getline(&buf, &len, fp);
    printf("%p\n", buf);
    printf("%ld\n", n);
    printf("%ld\n", len);
    printf("%s\n", buf);
    return 0;
}